package com.hdq.mapper;

import com.github.pagehelper.Page;
import com.hdq.annotation.AutoFill;
import com.hdq.enumeration.OperationType;
import entity.Notice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import vo.NoticePageVO;

import java.util.List;

@Mapper
public interface NoticeMapper {


    @Insert("insert into notice  (title,content,`order`,create_time,update_time) values (#{title},#{content},#{order},#{createTime},#{updateTime})" )
    @AutoFill(OperationType.INSERT)
    void insert(Notice notice);

    @Select("select  * from notice order by `order` desc ")
    Page<NoticePageVO> selectByPage(Integer page, Integer pageSize);

    void delete(List<Long> ids);

    @Update("update notice set title=#{title},content=#{content},`order`=#{order},update_time=#{updateTime} where id = #{id}")
    @AutoFill(OperationType.UPDATE)
    void update(Notice notice);
}
